﻿namespace OpenComposite.Repository.Forms.TrackingMonitor
{
	using System;
	using System.Collections.Generic;
	using System.ComponentModel;
	using System.Data;
	using System.Drawing;
	using System.Linq;
	using System.Text;
	using System.Windows.Forms;

	public partial class FormTrackingMonitor : Form
	{
		#region Initialization

		public FormTrackingMonitor()
		{
			InitializeComponent();
			_monitor = new TrackingMonitor();
			_monitor.Dock = DockStyle.Fill;
			_monitor.Close += new FormClosingEventHandler(_monitor_Close);
			this.Controls.Add(_monitor);
		}

		#endregion Initialization

		#region Private Members

		#region Fields

		TrackingMonitor _monitor = null;

		#endregion Fields

		#region Event Handlers

		private void FormTrackingMonitor_Shown(object sender, EventArgs e)
		{
			this.Refresh();
			try {
				_monitor.LoadInstances();
			} catch ( Exception ex ) {
				MessageBox.Show(
					string.Format("An error occured while loading tracking informations from the database.{0}",
					 ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
		}

		void _monitor_Close(object sender, FormClosingEventArgs e)
		{
			this.Close();
		}

		#endregion Event Handlers

		#endregion Private Members
	}
}